
<div class="row-fluid">
    <div class="span12">
        <div style="clear:both; height:20px"></div>
        <ul class="breadcrumb">
            <li>
                <a href="<?php echo $this->Html->url(array("controller" => "home", "action" => "index")); ?>">Home</a>
                <span class="divider">/</span>
            </li>
            <li class="active">
                <a href="<?php echo $this->Html->url(array("controller" => "home", "action" => "master")); ?>">マスター</a>
                <span class="divider">/</span>
            </li>
            <li class="active">カメラのデータベース  

            </li>
            
        </ul>

        <div class="row-fluid">
            <div class="span12">
                <div class="widget red">
                    <div class="widget-title">
                        <h4><i class="icon-reorder"></i> カメラ詳細情報</h4>
                        <span class="tools">
                            <a href="javascript:;" class="icon-chevron-down"></a>

                        </span>
                    </div>
                    <div class="widget-body">
                        <?php
                        echo $this->Form->create('Camera', array(
                            'inputDefaults' => array(
                                'div' => 'control-group',
                                'label' => array(
                                    'class' => 'control-label'
                                ),
                                'wrapInput' => 'controls'
                            ),
                            'class' => 'form-horizontal'
                        ));
                        ?>
                        <?php
                        echo $this->Form->input('CamID', array(
                            'placeholder' => 'カメラID',
                            'class' => 'span6',
                            'type' => 'text',
                            'label' => 'カメラID<span class="required"> *</span>',
                            'required' => false,
                            'maxlength' => '20',
                        ));
                        ?>
                        <?php
                        echo $this->Form->input('CamName', array(
                            'placeholder' => 'カメラ名',
                            'class' => 'span6',
                            'type' => 'text',
                            'label' => 'カメラ名<span class="required"> *</span>',
                            'required' => false,
                            'maxlength' => '100',
                        ));
                        ?>
                        <?php
                        echo $this->Form->input('CustId', array(
                            'label' => array(
                                'text' => 'お客様名<span class="required"> *</span>'
                            ),
                            'empty' => false,
                            'options' => $this->Common->listCustomer(),
                            'class' => 'span6',
                            'id' => 'search_customer',
                            'required' => false,
                        ));
                        ?>
                        <?php
                        echo $this->Form->input('BuildId', array(
                            'label' => array(
                                'text' => '物件名 <span class="required"> *</span>'
                            ),
                            'empty' => false,
                            'options' => $this->Common->listBulding(),
                            'class' => 'span6',
                            'id' => 'search_building',
                            'required' => false,
                        ));
                        ?>
                        <?php
                        echo $this->Form->input('UniIp', array(
                            'placeholder' => 'カメラのIPアドレス',
                            'class' => 'span6',
                            'type' => 'text',
                            'label' => 'IPアドレス<span class="required"> *</span>',
                            'required' => false,
                            'maxlength' => '49',
                        ));
                        ?>
                        <?php
                        echo $this->Form->input('UserName', array(
                            'placeholder' => 'カメラID',
                            'class' => 'span6',
                            'type' => 'text',
                            'label' => 'カメラID<span class="required"> *</span>',
                            'required' => false,
                            'maxlength' => '50',
                        ));
                        ?>
                        <?php
                        echo $this->Form->input('Password', array(
                            'placeholder' => 'カメラPW',
                            'class' => 'span6',
                            'type' => 'text',
                            'label' => 'カメラPW<span class="required"> *</span>',
                            'required' => false,
                            'maxlength' => '100',
                        ));

//                        echo $this->Form->input('MulIp', array(
//                            'placeholder' => 'Multicast IP',
//                            'class' => 'span6',
//                            'type' => 'text',
//                            'label' => 'Multicast IP<span class="required"> *</span>',
//                            'required' => false
//                        ));
                        ?>

                        <?php
                        echo $this->Form->input('HttpPort', array(
                            'placeholder' => 'Httpポット',
                            'class' => 'span6',
                            'type' => 'text',
                            'label' => 'Httpポット<span class="required"> *</span>',
                            'required' => false,
                            'maxlength' => '5',
                        ));
                        ?>
                        <?php
//                        echo $this->Form->input('CrtPort', array(
//                            'placeholder' => 'Control Port',
//                            'class' => 'span6',
//                            'type' => 'text',
//                            'label' => 'Control Port<span class="required"> *</span>',
//                            'required' => false
//                        ));
//                        echo $this->Form->input('SrtPort', array(
//                            'placeholder' => 'Streaming Port',
//                            'class' => 'span6',
//                            'type' => 'text',
//                            'label' => 'Streaming Port<span class="required"> *</span>',
//                            'required' => false
//                        ));
//                        echo $this->Form->input('MulPort', array(
//                            'placeholder' => 'Multicast Port',
//                            'class' => 'span6',
//                            'type' => 'text',
//                            'label' => 'Multicast Port<span class="required"> *</span>',
//                            'required' => false
//                        ));
//                        echo $this->Form->input('RegPort', array(
//                            'placeholder' => 'Register Port',
//                            'class' => 'span6',
//                            'type' => 'text',
//                            'label' => 'Register Port<span class="required"> *</span>',
//                            'required' => false
//                        ));
                        ?>
                        <?php
                        echo $this->Form->input('Model', array(
                            'placeholder' => 'カメラのモジュール',
                            'class' => 'span6',
                            'type' => 'text',
                            'label' => 'モジュール',
                            'required' => false,
                            'maxlength' => '200',
                        ));
                        ?>
                        <?php
                        /*echo $this->Form->input('Resolution', array(
                            'placeholder' => '解像度',
                            'class' => 'span6',
                            'label' => '解像度',
                            'required' => false,
                            'empty' => false,
                            'options' => $this->Common->getListResolution(),
                            'class' => 'span6',
                        ));*/
                        ?>
                        <div class="control-group">
                            <label for="CameraResolution" class="control-label">解像度</label>
                            <div class="controls form-inline">
                                <?php
                                echo $this->Form->input('ResolutionX', array(
                                    'placeholder' => '',
                                    'div' => false,
                                    'wrapInput' => false,
                                    'label' => false,
                                    'class' => 'input-small numberic',
                                    'type' => 'text',
                                    'afterInput' => '<label for="inputValue"> X </label>',
                                    'required' => false,
                                    'maxlength' => '5',
                                ));
                                echo $this->Form->input('ResolutionY', array(
                                    'placeholder' => '',
                                    'div' => false,
                                    'wrapInput' => false,
                                    'label' => false,
                                    'class' => 'input-small numberic',
                                    'type' => 'text',
                                    'required' => false,
                                    'maxlength' => '5',
                                ));
                                ?>
                            </div>
                        </div>
                       
                        <?php
                        echo $this->Form->input('FrameNo', array(
                            'placeholder' => 'フレーム数',
                            'class' => 'span6',
                            'label' => 'フレーム数',
                            'required' => false,
                            'type' => 'text'
                        ));
                        ?>
                        <?php
                        echo $this->Form->input('duration', array(
                            'label' => '期限(時間) <span class="required"> *</span>',
                            'placeholder' => '録画期間',
                            'class' => 'span6',
                            'type' => 'text',
                            'required' => false,
                            'maxlength' => '10',
                        ));
                        ?>

                        <?php
                        echo $this->Form->input('Note', array(
                            'placeholder' => '備考',
                            'label' => '備考',
                            'class' => 'span6',
                            'maxlength' => '300',
                        ));
                        ?>
                        <div class="form-actions">
                            <button type="submit" class="btn btn-success"><i class="icon-ok icon-white"></i> 保存</button>
                            <div type="button" class="btn btn-info">
                                <a href="<?php echo $this->Html->url(array("controller" => "Camera", "action" => "index")); ?>">
                                    <i class="icon-ban-circle icon-white"></i> 戻る
                                </a>
                            </div>
                        </div>
                        <?php echo $this->Form->end(); ?>
                    </div>
                </div>

            </div>
        </div>




    </div>
</div>

<script>
    $(document).ready(function() {
        //
        if ($("#search_customer").size() > 0) {
            getBuilding('<?php echo isset($_REQUEST['data']['Camera']['build_id']) ? $_REQUEST['data']['Camera']['build_id'] : "-1" ?>', 1);
        }
        $("#search_customer").on('change', function() {
            getBuilding(-1, 1);
        });
        $(".numberic").keydown(function(e) {
            // Allow: backspace, delete, tab, escape, enter and .
            if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
                    // Allow: Ctrl+A
                            (e.keyCode == 65 && e.ctrlKey === true) ||
                            // Allow: home, end, left, right
                                    (e.keyCode >= 35 && e.keyCode <= 39)) {
                        // let it happen, don't do anything
                        return;
                    }
                    // Ensure that it is a number and stop the keypress
                    if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
                        e.preventDefault();
                    }
                });

    });
</script>
<?php
//                echo $this->Form->input('FrameNo1', array(
//                        'placeholder' => '',
//                        'wrapInput' => 'controls form-inline',
//                        'label' => 'FrameNo',
//                        'class' => 'input-small',
//                        'type' => 'text',
//                        'afterInput' => '<label for="inputValue"> X </label><input name="data[Camera][FrameNo2]" class="input-small" type="text" value="" id="CameraFrameNo1">'
//                )); 
?>